<template>
	<view class="notice">
		<view class="time">{{ detail.createTime | timeFilter }}</view>
		<image class="img" mode="widthFix" :src="detail.fileUrl"></image>
		<view class="rich">
			<rich-text :nodes="detail.content"></rich-text>
		</view>
	</view>
</template>

<script>
	import {
		fetchNoticeById
	} from '@/services/notice.js';
	export default {
		data() {
			return {
				detail: {}
			};
		},
		onLoad({
			id
		}) {
			this.id = id;
			this.getData();
		},
		methods: {
			async getData() {
				const resp = await fetchNoticeById({
					noticeId: this.id
				});

				uni.setNavigationBarTitle({
					title: resp.title
				});
				this.detail = resp;
			}
		}
	};
</script>

<style lang="scss" scoped>
	.notice {
		.img {
			display: block;
			margin: 0 auto 20rpx;
			width: 700rpx;
		}

		.time {
			margin: 20rpx 0;
			text-align: right;
			padding-right: 20rpx;
			/* disp */
		}

		.rich {
			padding: 20rpx;
		}
	}
</style>
